uni.addInterceptor({
  returnValue (res, options = { errorIndex: 0, successIndex: 1 }) {
    if (!(!!res && (typeof res === "object" || typeof res === "function") && typeof res.then === "function")) {
      return res;
    }
    return new Promise((resolve, reject) => {
      res.then((result) => {
        if (result[options.errorIndex]) {
          reject(result[options.errorIndex]);
        } else {
          resolve(result[options.successIndex]);
        }
      }).catch((error) => {
        reject(error);
      });
    });
  },
});